<?php
class ScrapingClassTests extends \Enhance\TestFixture
{
        private $target;

        public function setUp()
        {
                $this->target = \Enhance\Core::getCodeCoverageWrapper('Scraping');
        }
		
        
        // Sets an url, first null then invalid and finally correct, expects null,null and true from validation
	    public function setCorrectUrlTest()
	    {
	    	$this->target->setUrl("");
	    	$test0 = $this->target->getUrl();
	    	
	    	$this->target->setUrl("htzzp://void");
	    	$test1 = $this->target->getUrl();
	    	
			$this->target->setUrl("http://www.fz.se/core/rss/fznews_rss20.xml");
			$test2 = $this->target->getUrl();
			
			\Enhance\Assert::isNull($test0);
	    	\Enhance\Assert::isNull($test1);
	    	\Enhance\Assert::isNotNull($test2);
	    }
	    
	    // Sets an expected url, uses the retrive function and expects them to be identical
	    public function getCorrectUrlTest()
	    {
	    	$testUrl = "http://www.test.com";
	    	$this->target->setUrl($testUrl);
	    	
	    	$result = $this->target->getUrl();
	    	\Enhance\Assert::areIdentical($testUrl, $result);
	    }
        
	    // Sends a xml url in and expects a result that isn't null, if null validation failed or none xml was returned 
	    public function retriveXmlTest() 
	    {
	        $this->target->setUrl("http://www.fz.se/core/rss/fznews_rss20.xml");
	        $result = $this->target->retriveXml();
	        
	        \Enhance\Assert::isNotNull($result);
	    }
}